﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using G15_Agent.Models;
using G15_Agent.Models.ViewModels;

namespace G15_Agent.Controllers
{
    public class CheckoutController : Controller
    {
        private AgentContext DatabaseSQL = new AgentContext();
        //
        // GET: /Checkout/
        public ActionResult HoaDonKhachHang(string maHoaDon)
        {
            CustomerCheckOutViewModel model = new CustomerCheckOutViewModel();
            HoaDonKH hoaDonKH = DatabaseSQL.HoaDonKHs.Find(maHoaDon);
            NguoiDung nguoiDung = DatabaseSQL.NguoiDungs.Find(hoaDonKH.MaNguoiDung);
            ChiTietHDKH[] dsChiTietHoaDon = DatabaseSQL.ChiTietHDKHs.Where(x => x.MaHD_KH.Equals(maHoaDon)).ToArray();
            model.nguoiDung = nguoiDung;
            model.hoaDonKH = hoaDonKH;
            model.dsChiTietHDKH = dsChiTietHoaDon;
            return View(model);
        }

    }
}
